# MODIFY HERE
corpus=/home/swlee4skmt/wta/corpus/ek-all


########################################################

if [ $# == 3 ]; then
	echo -n ""
else
	echo "usage: data-prepare.sh  [st|int|uni]  [r|ri|rid|...]  number(k)"
	exit
fi


scripts=`pwd`/scripts
misc=`pwd`/misc

symm=$1
copyopt=$2
label=$3

eval=1000
dev=1000
let train=label*1000
let all=eval+dev+train
let eval_dev=eval+dev

echo "Evaluation: " $eval
echo "Development:" $dev
echo "Training:   " $train

#### start automatic generation
dir=ek-${symm}-${copyopt}-${label}k.ccat
echo Creating $dir
rm -rf $dir; mkdir -p $dir;
cd $dir

##### running file
ln -s ${scripts}/run-all.sh .
ln -s ${scripts}/run-smt.sh .

##### INFO
mkdir info
cd info
ln -s $corpus/wa-gold.gui.giza  wa-gold.ans
ln -s $corpus/wa-gold.num wa-gold.nao
echo ${eval} > num-eval.var
echo ${dev} > num-dev.var
echo ${train} > num-train.var
echo ${symm} > symm.var
echo ${copyopt} > copyopt.var
cd ..

##### Init
mkdir i0; cd i0;
ln -s ${scripts}/copycat.sh .
ln -s ${scripts}/copycat-train.sh .
ln -s ${scripts}/make-next.sh .
echo 0 > now-itr.var

### corpus
mkdir corpus; cd corpus;
head -${eval} $corpus/en.SP                          > src-eval.tok
head -${eval_dev} $corpus/en.SP    | tail -${dev}    > src-dev.tok
head -${all} $corpus/en.SP         | tail -${train}  > src-train.tok
head -${all} $corpus/en.SP                           > src-all.tok

head -${eval} $corpus/en.parse                       > src-eval.parse
head -${eval_dev} $corpus/en.parse | tail -${dev}    > src-dev.parse
head -${all} $corpus/en.parse      | tail -${train}  > src-train.parse
head -${all} $corpus/en.parse                        > src-all.parse

head -${eval} $corpus/kr.SP                          > tgt-eval.tok
head -${eval_dev} $corpus/kr.SP    | tail -${dev}    > tgt-dev.tok
head -${all} $corpus/kr.SP         | tail -${train}  > tgt-train.tok
head -${all} $corpus/kr.SP                           > tgt-all.tok
cd ..

### WA
mkdir wa; cd wa;
ln -s ../corpus/src-all.tok src.tok
ln -s ../corpus/tgt-all.tok tgt.tok
ln -s ${scripts}/run-giza.sh .
ln -s ${scripts}/eval.sh .
ln -s ${misc}/giza_st.cfg .
ln -s ${misc}/giza_ts.cfg .
cd ..;

# SMT data
mkdir smt; cd smt;
cat ${scripts}/Makefile | sed s/VARIABLE/ek-${symm}-${copyopt}-${label}/ > Makefile
ln -s ../corpus/*.tok .
cd ..;

cd ..;
echo Done

